{extend name="admin/index"}

{block name="main"}
<h1>新增影片</h1>
<form class='mt20'>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="name">电影名</label>
    <input type="text" class="form-control" id="name">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="language">语言</label>
    <input type="text" class="form-control" id="language">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="duration">导演</label>
    <input type="text" class="form-control" id="duration">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="actor">演员</label>
    <input type="text" class="form-control" id="actor">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="release_time">影片时长</label>
    <input type="text" class="form-control" id="release_time">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="type">类型</label>
    <input type="text" class="form-control" id="type">
  </div>
</div>
<div class='container-fluid'>
  <div class="form-group col-xs-4">
    <label for="regions">地区</label>
    <input type="text" class="form-control" id="regions">
  </div>
</div>



<div class='container-fluid'>
  <div class="form-group col-xs-4">
  <button type="submit" class="btn btn-default mt20 create-btn">确认</button>
</div>
</div>
</form>
{/block}


{block name="js"}
<script>
  $(".filmcreate").addClass('active');


    $('.create-btn').click(function(){
        var name = $('#name').val();
        var language = $('#language').val();
        var duration = $('#duration').val();
        var actor = $('#actor').val();
        var type = $('#type').val();
        var regions = $('#regions').val();
        var release_time = $('#release_time').val();
        createajax(name, language, duration, actor, type, regions,release_time);
        return false;
    })


    function createajax(name, language, duration, actor, type, regions,release_time){
      $.ajax({
          type:'post',
          url:'/adfilm/',
          dataType :'json',
          data:{
            name: name,
            language: language,
            duration:duration,
            actor:actor,
            type:type,
            regions:regions,
            release_time:release_time,
          },
          success:function(data){
            alert(data.info);
            window.location.href="/adfilm/";
          },
          error:function(data){
            alert(data.info)
          }
      })
    }
</script>
{/block}